package com.kehao.leetcode.middle.array;

import org.junit.Test;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 解题思路
 * https://leetcode-cn.com/problems/increasing-triplet-subsequence/solution/c-xian-xing-shi-jian-fu-za-du-xiang-xi-jie-xi-da-b/
 */
public class ThreeIncreaseSubSequenceSolution {
    public boolean increasingTriplet(int[] nums) {
        int min = Integer.MAX_VALUE,mid = Integer.MAX_VALUE;
        for(int num:nums){
            if(num<min){
                min=num;
            }else if(num>min&&num<mid){
                mid = num;
            }else if(num>mid) {
                return true;
            }
        }
        return false;
    }

    @Test
    public void test01() {
        int[] nums = {1, 2, 3, 4, 5};
        System.out.println(increasingTriplet(nums));
    }

    @Test
    public void test02() {
        int[] nums = {5, 4, 3, 2, 1};
        System.out.println(increasingTriplet(nums));
    }

    @Test
    public void test03() {
        int[] nums = {2, 1, 5, 0, 4, 6};
        System.out.println(increasingTriplet(nums));
    }

    @Test
    public void test04() {
        int[] nums = {20, 100, 10, 12, 5, 13};
        System.out.println(increasingTriplet(nums));
    }

    @Test
    public void test05() {
        int[] nums = {1,5,0,4,1,3};
        System.out.println(increasingTriplet(nums));
    }


}
